home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / ld / ld.info-2 < prev    next >
Encoding:
GNU Info File  |  1996-07-15  |  47.2 KB  |  1,196 lines

  1. This is Info file ld.info, produced by Makeinfo-1.55 from the input
  2. file ./ld.texinfo.
  3.  
  4. START-INFO-DIR-ENTRY
  5. * Ld: (ld).                       The GNU linker.
  6. END-INFO-DIR-ENTRY
  7.  
  8.    This file documents the GNU linker LD.
  9.  
  10.    Copyright (C) 1991, 92, 93, 94, 95, 1996 Free Software Foundation,
  11. Inc.
  12.  
  13.    Permission is granted to make and distribute verbatim copies of this
  14. manual provided the copyright notice and this permission notice are
  15. preserved on all copies.
  16.  
  17.    Permission is granted to copy and distribute modified versions of
  18. this manual under the conditions for verbatim copying, provided also
  19. that the entire resulting derived work is distributed under the terms
  20. of a permission notice identical to this one.
  21.  
  22.    Permission is granted to copy and distribute translations of this
  23. manual into another language, under the above conditions for modified
  24. versions.
  25.  
  26. 
  27. File: ld.info,  Node: Arithmetic Functions,  Next: Semicolons,  Prev: Assignment,  Up: Expressions
  28.  
  29. Arithmetic Functions
  30. --------------------
  31.  
  32.    The command language includes a number of built-in functions for use
  33. in link script expressions.
  34. `ABSOLUTE(EXP)'
  35.      Return the absolute (non-relocatable, as opposed to non-negative)
  36.      value of the expression EXP.  Primarily useful to assign an
  37.      absolute value to a symbol within a section definition, where
  38.      symbol values are normally section-relative.
  39.  
  40. `ADDR(SECTION)'
  41.      Return the absolute address of the named SECTION.  Your script must
  42.      previously have defined the location of that section. In the
  43.      following example, `symbol_1' and `symbol_2' are assigned identical
  44.      values:
  45.           SECTIONS{ ...
  46.             .output1 :
  47.               {
  48.               start_of_output_1 = ABSOLUTE(.);
  49.               ...
  50.               }
  51.             .output :
  52.               {
  53.               symbol_1 = ADDR(.output1);
  54.               symbol_2 = start_of_output_1;
  55.               }
  56.           ... }
  57.  
  58. `ALIGN(EXP)'
  59.      Return the result of the current location counter (`.') aligned to
  60.      the next EXP boundary.  EXP must be an expression whose value is a
  61.      power of two.  This is equivalent to
  62.           (. + EXP - 1) & ~(EXP - 1)
  63.  
  64.      `ALIGN' doesn't change the value of the location counter--it just
  65.      does arithmetic on it.  As an example, to align the output `.data'
  66.      section to the next `0x2000' byte boundary after the preceding
  67.      section and to set a variable within the section to the next
  68.      `0x8000' boundary after the input sections:
  69.           SECTIONS{ ...
  70.             .data ALIGN(0x2000): {
  71.               *(.data)
  72.               variable = ALIGN(0x8000);
  73.             }
  74.           ... }
  75.  
  76.      The first use of `ALIGN' in this example specifies the location of
  77.      a section because it is used as the optional START attribute of a
  78.      section definition (*note Section Options::.).  The second use
  79.      simply defines the value of a variable.
  80.  
  81.      The built-in `NEXT' is closely related to `ALIGN'.
  82.  
  83. `DEFINED(SYMBOL)'
  84.      Return 1 if SYMBOL is in the linker global symbol table and is
  85.      defined, otherwise return 0.  You can use this function to provide
  86.      default values for symbols.  For example, the following
  87.      command-file fragment shows how to set a global symbol `begin' to
  88.      the first location in the `.text' section--but if a symbol called
  89.      `begin' already existed, its value is preserved:
  90.  
  91.           SECTIONS{ ...
  92.             .text : {
  93.               begin = DEFINED(begin) ? begin : . ;
  94.               ...
  95.             }
  96.           ... }
  97.  
  98. `NEXT(EXP)'
  99.      Return the next unallocated address that is a multiple of EXP.
  100.      This function is closely related to `ALIGN(EXP)'; unless you use
  101.      the `MEMORY' command to define discontinuous memory for the output
  102.      file, the two functions are equivalent.
  103.  
  104. `SIZEOF(SECTION)'
  105.      Return the size in bytes of the named SECTION, if that section has
  106.      been allocated.  In the following example, `symbol_1' and
  107.      `symbol_2' are assigned identical values:
  108.           SECTIONS{ ...
  109.             .output {
  110.               .start = . ;
  111.               ...
  112.               .end = . ;
  113.               }
  114.             symbol_1 = .end - .start ;
  115.             symbol_2 = SIZEOF(.output);
  116.           ... }
  117.  
  118. `SIZEOF_HEADERS'
  119. `sizeof_headers'
  120.      Return the size in bytes of the output file's headers.  You can
  121.      use this number as the start address of the first section, if you
  122.      choose, to facilitate paging.
  123.  
  124. 
  125. File: ld.info,  Node: Semicolons,  Prev: Arithmetic Functions,  Up: Expressions
  126.  
  127. Semicolons
  128. ----------
  129.  
  130.    Semicolons (";") are required in the following places.  In all other
  131. places they can appear for aesthetic reasons but are otherwise ignored.
  132.  
  133. `Assignment'
  134.      Semicolons must appear at the end of assignment expressions.
  135.      *Note Assignment::
  136.  
  137. `PHDRS'
  138.      Semicolons must appear at the end of a `PHDRS' statement.  *Note
  139.      PHDRS::
  140.  
  141. 
  142. File: ld.info,  Node: MEMORY,  Next: SECTIONS,  Prev: Expressions,  Up: Commands
  143.  
  144. Memory Layout
  145. =============
  146.  
  147.    The linker's default configuration permits allocation of all
  148. available memory.  You can override this configuration by using the
  149. `MEMORY' command.  The `MEMORY' command describes the location and size
  150. of blocks of memory in the target.  By using it carefully, you can
  151. describe which memory regions may be used by the linker, and which
  152. memory regions it must avoid.  The linker does not shuffle sections to
  153. fit into the available regions, but does move the requested sections
  154. into the correct regions and issue errors when the regions become too
  155. full.
  156.  
  157.    A command file may contain at most one use of the `MEMORY' command;
  158. however, you can define as many blocks of memory within it as you wish.
  159. The syntax is:
  160.  
  161.      MEMORY
  162.        {
  163.          NAME (ATTR) : ORIGIN = ORIGIN, LENGTH = LEN
  164.          ...
  165.        }
  166.  
  167. `NAME'
  168.      is a name used internally by the linker to refer to the region. Any
  169.      symbol name may be used.  The region names are stored in a separate
  170.      name space, and will not conflict with symbols, file names or
  171.      section names.  Use distinct names to specify multiple regions.
  172.  
  173. `(ATTR)'
  174.      is an optional list of attributes, permitted for compatibility
  175.      with the AT&T linker but not used by `ld' beyond checking that the
  176.      attribute list is valid.  Valid attribute lists must be made up of
  177.      the characters "`LIRWX'".  If you omit the attribute list, you may
  178.      omit the parentheses around it as well.
  179.  
  180. `ORIGIN'
  181.      is the start address of the region in physical memory.  It is an
  182.      expression that must evaluate to a constant before memory
  183.      allocation is performed. The keyword `ORIGIN' may be abbreviated
  184.      to `org' or `o' (but not, for example, `ORG').
  185.  
  186. `LEN'
  187.      is the size in bytes of the region (an expression).  The keyword
  188.      `LENGTH' may be abbreviated to `len' or `l'.
  189.  
  190.    For example, to specify that memory has two regions available for
  191. allocation--one starting at 0 for 256 kilobytes, and the other starting
  192. at `0x40000000' for four megabytes:
  193.  
  194.      MEMORY
  195.        {
  196.        rom : ORIGIN = 0, LENGTH = 256K
  197.        ram : org = 0x40000000, l = 4M
  198.        }
  199.  
  200.    Once you have defined a region of memory named MEM, you can direct
  201. specific output sections there by using a command ending in `>MEM'
  202. within the `SECTIONS' command (*note Section Options::.).  If the
  203. combined output sections directed to a region are too big for the
  204. region, the linker will issue an error message.
  205.  
  206. 
  207. File: ld.info,  Node: SECTIONS,  Next: PHDRS,  Prev: MEMORY,  Up: Commands
  208.  
  209. Specifying Output Sections
  210. ==========================
  211.  
  212.    The `SECTIONS' command controls exactly where input sections are
  213. placed into output sections, their order in the output file, and to
  214. which output sections they are allocated.
  215.  
  216.    You may use at most one `SECTIONS' command in a script file, but you
  217. can have as many statements within it as you wish.  Statements within
  218. the `SECTIONS' command can do one of three things:
  219.  
  220.    * define the entry point;
  221.  
  222.    * assign a value to a symbol;
  223.  
  224.    * describe the placement of a named output section, and which input
  225.      sections go into it.
  226.  
  227.    You can also use the first two operations--defining the entry point
  228. and defining symbols--outside the `SECTIONS' command: *note Entry
  229. Point::., and *Note Assignment::.  They are permitted here as well for
  230. your convenience in reading the script, so that symbols and the entry
  231. point can be defined at meaningful points in your output-file layout.
  232.  
  233.    If you do not use a `SECTIONS' command, the linker places each input
  234. section into an identically named output section in the order that the
  235. sections are first encountered in the input files.  If all input
  236. sections are present in the first file, for example, the order of
  237. sections in the output file will match the order in the first input
  238. file.
  239.  
  240. * Menu:
  241.  
  242. * Section Definition::          Section Definitions
  243. * Section Placement::           Section Placement
  244. * Section Data Expressions::    Section Data Expressions
  245. * Section Options::             Optional Section Attributes
  246.  
  247. 
  248. File: ld.info,  Node: Section Definition,  Next: Section Placement,  Up: SECTIONS
  249.  
  250. Section Definitions
  251. -------------------
  252.  
  253.    The most frequently used statement in the `SECTIONS' command is the
  254. "section definition", which specifies the properties of an output
  255. section: its location, alignment, contents, fill pattern, and target
  256. memory region.  Most of these specifications are optional; the simplest
  257. form of a section definition is
  258.      SECTIONS { ...
  259.        SECNAME : {
  260.          CONTENTS
  261.        }
  262.      ... }
  263.  
  264. SECNAME is the name of the output section, and CONTENTS a specification
  265. of what goes there--for example, a list of input files or sections of
  266. input files (*note Section Placement::.).  As you might assume, the
  267. whitespace shown is optional.  You do need the colon `:' and the braces
  268. `{}', however.
  269.  
  270.    SECNAME must meet the constraints of your output format.  In formats
  271. which only support a limited number of sections, such as `a.out', the
  272. name must be one of the names supported by the format (`a.out', for
  273. example, allows only `.text', `.data' or `.bss'). If the output format
  274. supports any number of sections, but with numbers and not names (as is
  275. the case for Oasys), the name should be supplied as a quoted numeric
  276. string.  A section name may consist of any sequence of characters, but
  277. any name which does not conform to the standard `ld' symbol name syntax
  278. must be quoted.  *Note Symbol Names: Symbols.
  279.  
  280.    The special SECNAME `/DISCARD/' may be used to discard input
  281. sections.  Any sections which are assigned to an output section named
  282. `/DISCARD/' are not included in the final link output.
  283.  
  284.    The linker will not create output sections which do not have any
  285. contents.  This is for convenience when referring to input sections that
  286. may or may not exist.  For example,
  287.      .foo { *(.foo) }
  288.    will only create a `.foo' section in the output file if there is a
  289. `.foo' section in at least one input file.
  290.  
  291. 
  292. File: ld.info,  Node: Section Placement,  Next: Section Data Expressions,  Prev: Section Definition,  Up: SECTIONS
  293.  
  294. Section Placement
  295. -----------------
  296.  
  297.    In a section definition, you can specify the contents of an output
  298. section by listing particular input files, by listing particular
  299. input-file sections, or by a combination of the two.  You can also place
  300. arbitrary data in the section, and define symbols relative to the
  301. beginning of the section.
  302.  
  303.    The CONTENTS of a section definition may include any of the
  304. following kinds of statement.  You can include as many of these as you
  305. like in a single section definition, separated from one another by
  306. whitespace.
  307.  
  308. `FILENAME'
  309.      You may simply name a particular input file to be placed in the
  310.      current output section; *all* sections from that file are placed
  311.      in the current section definition.  If the file name has already
  312.      been mentioned in another section definition, with an explicit
  313.      section name list, then only those sections which have not yet
  314.      been allocated are used.
  315.  
  316.      To specify a list of particular files by name:
  317.           .data : { afile.o bfile.o cfile.o }
  318.  
  319.      The example also illustrates that multiple statements can be
  320.      included in the contents of a section definition, since each file
  321.      name is a separate statement.
  322.  
  323. `FILENAME( SECTION )'
  324. `FILENAME( SECTION , SECTION, ... )'
  325. `FILENAME( SECTION SECTION ... )'
  326.      You can name one or more sections from your input files, for
  327.      insertion in the current output section.  If you wish to specify a
  328.      list of input-file sections inside the parentheses, you may
  329.      separate the section names by either commas or whitespace.
  330.  
  331. `* (SECTION)'
  332. `* (SECTION, SECTION, ...)'
  333. `* (SECTION SECTION ...)'
  334.      Instead of explicitly naming particular input files in a link
  335.      control script, you can refer to *all* files from the `ld' command
  336.      line: use `*' instead of a particular file name before the
  337.      parenthesized input-file section list.
  338.  
  339.      If you have already explicitly included some files by name, `*'
  340.      refers to all *remaining* files--those whose places in the output
  341.      file have not yet been defined.
  342.  
  343.      For example, to copy sections `1' through `4' from an Oasys file
  344.      into the `.text' section of an `a.out' file, and sections `13' and
  345.      `14' into the `.data' section:
  346.           SECTIONS {
  347.             .text :{
  348.               *("1" "2" "3" "4")
  349.             }
  350.           
  351.             .data :{
  352.               *("13" "14")
  353.             }
  354.           }
  355.  
  356.      `[ SECTION ... ]' used to be accepted as an alternate way to
  357.      specify named sections from all unallocated input files.  Because
  358.      some operating systems (VMS) allow brackets in file names, that
  359.      notation is no longer supported.
  360.  
  361. `FILENAME`( COMMON )''
  362. `*( COMMON )'
  363.      Specify where in your output file to place uninitialized data with
  364.      this notation.  `*(COMMON)' by itself refers to all uninitialized
  365.      data from all input files (so far as it is not yet allocated);
  366.      FILENAME`(COMMON)' refers to uninitialized data from a particular
  367.      file.  Both are special cases of the general mechanisms for
  368.      specifying where to place input-file sections: `ld' permits you to
  369.      refer to uninitialized data as if it were in an input-file section
  370.      named `COMMON', regardless of the input file's format.
  371.  
  372.    For example, the following command script arranges the output file
  373. into three consecutive sections, named `.text', `.data', and `.bss',
  374. taking the input for each from the correspondingly named sections of
  375. all the input files:
  376.  
  377.      SECTIONS {
  378.        .text : { *(.text) }
  379.        .data : { *(.data) }
  380.        .bss :  { *(.bss)  *(COMMON) }
  381.      }
  382.  
  383.    The following example reads all of the sections from file `all.o'
  384. and places them at the start of output section `outputa' which starts
  385. at location `0x10000'. All of section `.input1' from file `foo.o'
  386. follows immediately, in the same output section.  All of section
  387. `.input2' from `foo.o' goes into output section `outputb', followed by
  388. section `.input1' from `foo1.o'.  All of the remaining `.input1' and
  389. `.input2' sections from any files are written to output section
  390. `outputc'.
  391.  
  392.      SECTIONS {
  393.        outputa 0x10000 :
  394.          {
  395.          all.o
  396.          foo.o (.input1)
  397.          }
  398.        outputb :
  399.          {
  400.          foo.o (.input2)
  401.          foo1.o (.input1)
  402.          }
  403.        outputc :
  404.          {
  405.          *(.input1)
  406.          *(.input2)
  407.          }
  408.      }
  409.  
  410. 
  411. File: ld.info,  Node: Section Data Expressions,  Next: Section Options,  Prev: Section Placement,  Up: SECTIONS
  412.  
  413. Section Data Expressions
  414. ------------------------
  415.  
  416.    The foregoing statements arrange, in your output file, data
  417. originating from your input files.  You can also place data directly in
  418. an output section from the link command script.  Most of these
  419. additional statements involve expressions (*note Expressions::.).
  420. Although these statements are shown separately here for ease of
  421. presentation, no such segregation is needed within a section definition
  422. in the `SECTIONS' command; you can intermix them freely with any of the
  423. statements we've just described.
  424.  
  425. `CREATE_OBJECT_SYMBOLS'
  426.      Create a symbol for each input file in the current section, set to
  427.      the address of the first byte of data written from that input
  428.      file.  For instance, with `a.out' files it is conventional to have
  429.      a symbol for each input file.  You can accomplish this by defining
  430.      the output `.text' section as follows:
  431.           SECTIONS {
  432.             .text 0x2020 :
  433.                {
  434.               CREATE_OBJECT_SYMBOLS
  435.               *(.text)
  436.               _etext = ALIGN(0x2000);
  437.               }
  438.             ...
  439.           }
  440.  
  441.      If `sample.ld' is a file containing this script, and `a.o', `b.o',
  442.      `c.o', and `d.o' are four input files with contents like the
  443.      following--
  444.           /* a.c */
  445.           
  446.           afunction() { }
  447.           int adata=1;
  448.           int abss;
  449.  
  450.      `ld -M -T sample.ld a.o b.o c.o d.o' would create a map like this,
  451.      containing symbols matching the object file names:
  452.           00000000 A __DYNAMIC
  453.           00004020 B _abss
  454.           00004000 D _adata
  455.           00002020 T _afunction
  456.           00004024 B _bbss
  457.           00004008 D _bdata
  458.           00002038 T _bfunction
  459.           00004028 B _cbss
  460.           00004010 D _cdata
  461.           00002050 T _cfunction
  462.           0000402c B _dbss
  463.           00004018 D _ddata
  464.           00002068 T _dfunction
  465.           00004020 D _edata
  466.           00004030 B _end
  467.           00004000 T _etext
  468.           00002020 t a.o
  469.           00002038 t b.o
  470.           00002050 t c.o
  471.           00002068 t d.o
  472.  
  473. `SYMBOL = EXPRESSION ;'
  474. `SYMBOL F= EXPRESSION ;'
  475.      SYMBOL is any symbol name (*note Symbols::.).  "F=" refers to any
  476.      of the operators `&= += -= *= /=' which combine arithmetic and
  477.      assignment.
  478.  
  479.      When you assign a value to a symbol within a particular section
  480.      definition, the value is relative to the beginning of the section
  481.      (*note Assignment::.).  If you write
  482.  
  483.           SECTIONS {
  484.             abs = 14 ;
  485.             ...
  486.             .data : { ... rel = 14 ; ... }
  487.             abs2 = 14 + ADDR(.data);
  488.             ...
  489.           }
  490.  
  491.      `abs' and `rel' do not have the same value; `rel' has the same
  492.      value as `abs2'.
  493.  
  494. `BYTE(EXPRESSION)'
  495. `SHORT(EXPRESSION)'
  496. `LONG(EXPRESSION)'
  497. `QUAD(EXPRESSION)'
  498.      By including one of these four statements in a section definition,
  499.      you can explicitly place one, two, four, or eight bytes
  500.      (respectively) at the current address of that section.  `QUAD' is
  501.      only supported when using a 64 bit host or target.
  502.  
  503.      Multiple-byte quantities are represented in whatever byte order is
  504.      appropriate for the output file format (*note BFD::.).
  505.  
  506. `FILL(EXPRESSION)'
  507.      Specify the "fill pattern" for the current section.  Any otherwise
  508.      unspecified regions of memory within the section (for example,
  509.      regions you skip over by assigning a new value to the location
  510.      counter `.') are filled with the two least significant bytes from
  511.      the EXPRESSION argument.  A `FILL' statement covers memory
  512.      locations *after* the point it occurs in the section definition; by
  513.      including more than one `FILL' statement, you can have different
  514.      fill patterns in different parts of an output section.
  515.  
  516. 
  517. File: ld.info,  Node: Section Options,  Prev: Section Data Expressions,  Up: SECTIONS
  518.  
  519. Optional Section Attributes
  520. ---------------------------
  521.  
  522.    Here is the full syntax of a section definition, including all the
  523. optional portions:
  524.  
  525.      SECTIONS {
  526.      ...
  527.      SECNAME START BLOCK(ALIGN) (NOLOAD) : AT ( LDADR )
  528.        { CONTENTS } >REGION :PHDR =FILL
  529.      ...
  530.      }
  531.  
  532.    SECNAME and CONTENTS are required.  *Note Section Definition::, and
  533. *Note Section Placement::, for details on CONTENTS.  The remaining
  534. elements--START, `BLOCK(ALIGN)', `(NOLOAD)', `AT ( LDADR )', `>REGION',
  535. `:PHDR', and `=FILL'--are all optional.
  536.  
  537. `START'
  538.      You can force the output section to be loaded at a specified
  539.      address by specifying START immediately following the section name.
  540.      sTART can be represented as any expression. The following example
  541.      generates section OUTPUT at location `0x40000000':
  542.  
  543.           SECTIONS {
  544.             ...
  545.             output 0x40000000: {
  546.               ...
  547.               }
  548.             ...
  549.           }
  550.  
  551. `BLOCK(ALIGN)'
  552.      You can include `BLOCK()' specification to advance the location
  553.      counter `.' prior to the beginning of the section, so that the
  554.      section will begin at the specified alignment.  ALIGN is an
  555.      expression.
  556.  
  557. `(NOLOAD)'
  558.      Use `(NOLOAD)' to prevent a section from being loaded into memory
  559.      each time it is accessed.  For example, in the script sample
  560.      below, the `ROM' segment is addressed at memory location `0' and
  561.      does not need to be loaded into each object file:
  562.  
  563.           SECTIONS {
  564.             ROM  0  (NOLOAD)  : { ... }
  565.             ...
  566.           }
  567.  
  568. `AT ( LDADR )'
  569.      The expression LDADR that follows the `AT' keyword specifies the
  570.      load address of the section.  The default (if you do not use the
  571.      `AT' keyword) is to make the load address the same as the
  572.      relocation address.  This feature is designed to make it easy to
  573.      build a ROM image.  For example, this `SECTIONS' definition
  574.      creates two output sections: one called `.text', which starts at
  575.      `0x1000', and one called `.mdata', which is loaded at the end of
  576.      the `.text' section even though its relocation address is
  577.      `0x2000'.  The symbol `_data' is defined with the value `0x2000':
  578.  
  579.           SECTIONS
  580.             {
  581.             .text 0x1000 : { *(.text) _etext = . ; }
  582.             .mdata 0x2000 :
  583.               AT ( ADDR(.text) + SIZEOF ( .text ) )
  584.               { _data = . ; *(.data); _edata = . ;  }
  585.             .bss 0x3000 :
  586.               { _bstart = . ;  *(.bss) *(COMMON) ; _bend = . ;}
  587.           }
  588.  
  589.      The run-time initialization code (for C programs, usually `crt0')
  590.      for use with a ROM generated this way has to include something like
  591.      the following, to copy the initialized data from the ROM image to
  592.      its runtime address:
  593.  
  594.           char *src = _etext;
  595.           char *dst = _data;
  596.           
  597.           /* ROM has data at end of text; copy it. */
  598.           while (dst < _edata) {
  599.             *dst++ = *src++;
  600.           }
  601.           
  602.           /* Zero bss */
  603.           for (dst = _bstart; dst< _bend; dst++)
  604.             *dst = 0;
  605.  
  606. `>REGION'
  607.      Assign this section to a previously defined region of memory.
  608.      *Note MEMORY::.
  609.  
  610. `:PHDR'
  611.      Assign this section to a segment described by a program header.
  612.      *Note PHDRS::.  If a section is assigned to one or more segments,
  613.      then all subsequent allocated sections will be assigned to those
  614.      segments as well, unless they use an explicitly `:PHDR' modifier.
  615.      To prevent a section from being assigned to a segment when it would
  616.      normally default to one, use `:NONE'.
  617.  
  618. `=FILL'
  619.      Including `=FILL' in a section definition specifies the initial
  620.      fill value for that section.  You may use any expression to
  621.      specify FILL.  Any unallocated holes in the current output section
  622.      when written to the output file will be filled with the two least
  623.      significant bytes of the value, repeated as necessary.  You can
  624.      also change the fill value with a `FILL' statement in the CONTENTS
  625.      of a section definition.
  626.  
  627. 
  628. File: ld.info,  Node: PHDRS,  Next: Entry Point,  Prev: SECTIONS,  Up: Commands
  629.  
  630. ELF Program Headers
  631. ===================
  632.  
  633.    The ELF object file format uses "program headers", which are read by
  634. the system loader and describe how the program should be loaded into
  635. memory.  These program headers must be set correctly in order to run the
  636. program on a native ELF system.  The linker will create reasonable
  637. program headers by default.  However, in some cases, it is desirable to
  638. specify the program headers more precisely; the `PHDRS' command may be
  639. used for this purpose.  When the `PHDRS' command is used, the linker
  640. will not generate any program headers itself.
  641.  
  642.    The `PHDRS' command is only meaningful when generating an ELF output
  643. file.  It is ignored in other cases.  This manual does not describe the
  644. details of how the system loader interprets program headers; for more
  645. information, see the ELF ABI.  The program headers of an ELF file may
  646. be displayed using the `-p' option of the `objdump' command.
  647.  
  648.    This is the syntax of the `PHDRS' command.  The words `PHDRS',
  649. `FILEHDR', `AT', and `FLAGS' are keywords.
  650.  
  651.      PHDRS
  652.      {
  653.        NAME TYPE [ FILEHDR ] [ PHDRS ] [ AT ( ADDRESS ) ]
  654.              [ FLAGS ( FLAGS ) ] ;
  655.      }
  656.  
  657.    The NAME is used only for reference in the `SECTIONS' command of the
  658. linker script.  It does not get put into the output file.
  659.  
  660.    Certain program header types describe segments of memory which are
  661. loaded from the file by the system loader.  In the linker script, the
  662. contents of these segments are specified by directing allocated output
  663. sections to be placed in the segment.  To do this, the command
  664. describing the output section in the `SECTIONS' command should use
  665. `:NAME', where NAME is the name of the program header as it appears in
  666. the `PHDRS' command.  *Note Section Options::.
  667.  
  668.    It is normal for certain sections to appear in more than one segment.
  669. This merely implies that one segment of memory contains another.  This
  670. is specified by repeating `:NAME', using it once for each program
  671. header in which the section is to appear.
  672.  
  673.    If a section is placed in one or more segments using `:NAME', then
  674. all subsequent allocated sections which do not specify `:NAME' are
  675. placed in the same segments.  This is for convenience, since generally
  676. a whole set of contiguous sections will be placed in a single segment.
  677. To prevent a section from being assigned to a segment when it would
  678. normally default to one, use `:NONE'.
  679.  
  680.    The `FILEHDR' and `PHDRS' keywords which may appear after the
  681. program header type also indicate contents of the segment of memory.
  682. The `FILEHDR' keyword means that the segment should include the ELF
  683. file header.  The `PHDRS' keyword means that the segment should include
  684. the ELF program headers themselves.
  685.  
  686.    The TYPE may be one of the following.  The numbers indicate the
  687. value of the keyword.
  688.  
  689. `PT_NULL' (0)
  690.      Indicates an unused program header.
  691.  
  692. `PT_LOAD' (1)
  693.      Indicates that this program header describes a segment to be
  694.      loaded from the file.
  695.  
  696. `PT_DYNAMIC' (2)
  697.      Indicates a segment where dynamic linking information can be found.
  698.  
  699. `PT_INTERP' (3)
  700.      Indicates a segment where the name of the program interpreter may
  701.      be found.
  702.  
  703. `PT_NOTE' (4)
  704.      Indicates a segment holding note information.
  705.  
  706. `PT_SHLIB' (5)
  707.      A reserved program header type, defined but not specified by the
  708.      ELF ABI.
  709.  
  710. `PT_PHDR' (6)
  711.      Indicates a segment where the program headers may be found.
  712.  
  713. EXPRESSION
  714.      An expression giving the numeric type of the program header.  This
  715.      may be used for types not defined above.
  716.  
  717.    It is possible to specify that a segment should be loaded at a
  718. particular address in memory.  This is done using an `AT' expression.
  719. This is identical to the `AT' command used in the `SECTIONS' command
  720. (*note Section Options::.).  Using the `AT' command for a program
  721. header overrides any information in the `SECTIONS' command.
  722.  
  723.    Normally the segment flags are set based on the sections.  The
  724. `FLAGS' keyword may be used to explicitly specify the segment flags.
  725. The value of FLAGS must be an integer.  It is used to set the `p_flags'
  726. field of the program header.
  727.  
  728.    Here is an example of the use of `PHDRS'.  This shows a typical set
  729. of program headers used on a native ELF system.
  730.  
  731.      PHDRS
  732.      {
  733.        headers PT_PHDR PHDRS ;
  734.        interp PT_INTERP ;
  735.        text PT_LOAD FILEHDR PHDRS ;
  736.        data PT_LOAD ;
  737.        dynamic PT_DYNAMIC ;
  738.      }
  739.      
  740.      SECTIONS
  741.      {
  742.        . = SIZEOF_HEADERS;
  743.        .interp : { *(.interp) } :text :interp
  744.        .text : { *(.text) } :text
  745.        .rodata : { *(.rodata) } /* defaults to :text */
  746.        ...
  747.        . = . + 0x1000; /* move to a new page in memory */
  748.        .data : { *(.data) } :data
  749.        .dynamic : { *(.dynamic) } :data :dynamic
  750.        ...
  751.      }
  752.  
  753. 
  754. File: ld.info,  Node: Entry Point,  Next: Option Commands,  Prev: PHDRS,  Up: Commands
  755.  
  756. The Entry Point
  757. ===============
  758.  
  759.    The linker command language includes a command specifically for
  760. defining the first executable instruction in an output file (its "entry
  761. point").  Its argument is a symbol name:
  762.      ENTRY(SYMBOL)
  763.  
  764.    Like symbol assignments, the `ENTRY' command may be placed either as
  765. an independent command in the command file, or among the section
  766. definitions within the `SECTIONS' command--whatever makes the most
  767. sense for your layout.
  768.  
  769.    `ENTRY' is only one of several ways of choosing the entry point.
  770. You may indicate it in any of the following ways (shown in descending
  771. order of priority: methods higher in the list override methods lower
  772. down).
  773.    * the `-e' ENTRY command-line option;
  774.  
  775.    * the `ENTRY(SYMBOL)' command in a linker control script;
  776.  
  777.    * the value of the symbol `start', if present;
  778.  
  779.    * the address of the first byte of the `.text' section, if present;
  780.  
  781.    * The address `0'.
  782.  
  783.    For example, you can use these rules to generate an entry point with
  784. an assignment statement: if no symbol `start' is defined within your
  785. input files, you can simply define it, assigning it an appropriate
  786. value--
  787.  
  788.      start = 0x2020;
  789.  
  790. The example shows an absolute address, but you can use any expression.
  791. For example, if your input object files use some other symbol-name
  792. convention for the entry point, you can just assign the value of
  793. whatever symbol contains the start address to `start':
  794.  
  795.      start = other_symbol ;
  796.  
  797. 
  798. File: ld.info,  Node: Option Commands,  Prev: Entry Point,  Up: Commands
  799.  
  800. Option Commands
  801. ===============
  802.  
  803.    The command language includes a number of other commands that you can
  804. use for specialized purposes.  They are similar in purpose to
  805. command-line options.
  806.  
  807. `CONSTRUCTORS'
  808.      When linking using the `a.out' object file format, the linker uses
  809.      an unusual set construct to support C++ global constructors and
  810.      destructors.  When linking object file formats which do not support
  811.      arbitrary sections, such as `ECOFF' and `XCOFF', the linker will
  812.      automatically recognize C++ global constructors and destructors by
  813.      name.  For these object file formats, the `CONSTRUCTORS' command
  814.      tells the linker where this information should be placed.  The
  815.      `CONSTRUCTORS' command is ignored for other object file formats.
  816.  
  817.      The symbol `__CTOR_LIST__' marks the start of the global
  818.      constructors, and the symbol `__DTOR_LIST' marks the end.  The
  819.      first word in the list is the number of entries, followed by the
  820.      address of each constructor or destructor, followed by a zero
  821.      word.  The compiler must arrange to actually run the code.  For
  822.      these object file formats GNU C++ calls constructors from a
  823.      subroutine `__main'; a call to `__main' is automatically inserted
  824.      into the startup code for `main'.  GNU C++ runs destructors either
  825.      by using `atexit', or directly from the function `exit'.
  826.  
  827.      For object file formats such as `COFF' or `ELF' which support
  828.      multiple sections, GNU C++ will normally arrange to put the
  829.      addresses of global constructors and destructors into the `.ctors'
  830.      and `.dtors' sections.  Placing the following sequence into your
  831.      linker script will build the sort of table which the GNU C++
  832.      runtime code expects to see.
  833.  
  834.                 __CTOR_LIST__ = .;
  835.                 LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  836.                 *(.ctors)
  837.                 LONG(0)
  838.                 __CTOR_END__ = .;
  839.                 __DTOR_LIST__ = .;
  840.                 LONG((__DTOR_END__ - __DTOR_LIST__) / 4 - 2)
  841.                 *(.dtors)
  842.                 LONG(0)
  843.                 __DTOR_END__ = .;
  844.  
  845.      Normally the compiler and linker will handle these issues
  846.      automatically, and you will not need to concern yourself with
  847.      them.  However, you may need to consider this if you are using C++
  848.      and writing your own linker scripts.
  849.  
  850. `FLOAT'
  851. `NOFLOAT'
  852.      These keywords were used in some older linkers to request a
  853.      particular math subroutine library.  `ld' doesn't use the
  854.      keywords, assuming instead that any necessary subroutines are in
  855.      libraries specified using the general mechanisms for linking to
  856.      archives; but to permit the use of scripts that were written for
  857.      the older linkers, the keywords `FLOAT' and `NOFLOAT' are accepted
  858.      and ignored.
  859.  
  860. `FORCE_COMMON_ALLOCATION'
  861.      This command has the same effect as the `-d' command-line option:
  862.      to make `ld' assign space to common symbols even if a relocatable
  863.      output file is specified (`-r').
  864.  
  865. `INPUT ( FILE, FILE, ... )'
  866. `INPUT ( FILE FILE ... )'
  867.      Use this command to include binary input files in the link, without
  868.      including them in a particular section definition.  Specify the
  869.      full name for each FILE, including `.a' if required.
  870.  
  871.      `ld' searches for each FILE through the archive-library search
  872.      path, just as for files you specify on the command line.  See the
  873.      description of `-L' in *Note Command Line Options: Options.
  874.  
  875.      If you use `-lFILE', `ld' will transform the name to `libFILE.a'
  876.      as with the command line argument `-l'.
  877.  
  878. `GROUP ( FILE, FILE, ... )'
  879. `GROUP ( FILE FILE ... )'
  880.      This command is like `INPUT', except that the named files should
  881.      all be archives, and they are searched repeatedly until no new
  882.      undefined references are created.  See the description of `-(' in
  883.      *Note Command Line Options: Options.
  884.  
  885. `OUTPUT ( FILENAME )'
  886.      Use this command to name the link output file FILENAME.  The
  887.      effect of `OUTPUT(FILENAME)' is identical to the effect of
  888.      `-o FILENAME', which overrides it.  You can use this command to
  889.      supply a default output-file name other than `a.out'.
  890.  
  891. `OUTPUT_ARCH ( BFDNAME )'
  892.      Specify a particular output machine architecture, with one of the
  893.      names used by the BFD back-end routines (*note BFD::.).  This
  894.      command is often unnecessary; the architecture is most often set
  895.      implicitly by either the system BFD configuration or as a side
  896.      effect of the `OUTPUT_FORMAT' command.
  897.  
  898. `OUTPUT_FORMAT ( BFDNAME )'
  899.      When `ld' is configured to support multiple object code formats,
  900.      you can use this command to specify a particular output format.
  901.      bFDNAME is one of the names used by the BFD back-end routines
  902.      (*note BFD::.).  The effect is identical to the effect of the
  903.      `-oformat' command-line option.  This selection affects only the
  904.      output file; the related command `TARGET' affects primarily input
  905.      files.
  906.  
  907. `SEARCH_DIR ( PATH )'
  908.      Add PATH to the list of paths where `ld' looks for archive
  909.      libraries.  `SEARCH_DIR(PATH)' has the same effect as `-LPATH' on
  910.      the command line.
  911.  
  912. `STARTUP ( FILENAME )'
  913.      Ensure that FILENAME is the first input file used in the link
  914.      process.
  915.  
  916. `TARGET ( FORMAT )'
  917.      When `ld' is configured to support multiple object code formats,
  918.      you can use this command to change the input-file object code
  919.      format (like the command-line option `-b' or its synonym
  920.      `-format').  The argument FORMAT is one of the strings used by BFD
  921.      to name binary formats.  If `TARGET' is specified but
  922.      `OUTPUT_FORMAT' is not, the last `TARGET' argument is also used as
  923.      the default format for the `ld' output file.  *Note BFD::.
  924.  
  925.      If you don't use the `TARGET' command, `ld' uses the value of the
  926.      environment variable `GNUTARGET', if available, to select the
  927.      output file format.  If that variable is also absent, `ld' uses
  928.      the default format configured for your machine in the BFD
  929.      libraries.
  930.  
  931. 
  932. File: ld.info,  Node: Machine Dependent,  Next: BFD,  Prev: Commands,  Up: Top
  933.  
  934. Machine Dependent Features
  935. **************************
  936.  
  937.    `ld' has additional features on some platforms; the following
  938. sections describe them.  Machines where `ld' has no additional
  939. functionality are not listed.
  940.  
  941. * Menu:
  942.  
  943. * H8/300::                      `ld' and the H8/300
  944. * i960::                        `ld' and the Intel 960 family
  945.  
  946. 
  947. File: ld.info,  Node: H8/300,  Next: i960,  Up: Machine Dependent
  948.  
  949. `ld' and the H8/300
  950. ===================
  951.  
  952.    For the H8/300, `ld' can perform these global optimizations when you
  953. specify the `-relax' command-line option.
  954.  
  955. *relaxing address modes*
  956.      `ld' finds all `jsr' and `jmp' instructions whose targets are
  957.      within eight bits, and turns them into eight-bit program-counter
  958.      relative `bsr' and `bra' instructions, respectively.
  959.  
  960. *synthesizing instructions*
  961.      `ld' finds all `mov.b' instructions which use the sixteen-bit
  962.      absolute address form, but refer to the top page of memory, and
  963.      changes them to use the eight-bit address form.  (That is: the
  964.      linker turns `mov.b `@'AA:16' into `mov.b `@'AA:8' whenever the
  965.      address AA is in the top page of memory).
  966.  
  967. 
  968. File: ld.info,  Node: i960,  Prev: H8/300,  Up: Machine Dependent
  969.  
  970. `ld' and the Intel 960 family
  971. =============================
  972.  
  973.    You can use the `-AARCHITECTURE' command line option to specify one
  974. of the two-letter names identifying members of the 960 family; the
  975. option specifies the desired output target, and warns of any
  976. incompatible instructions in the input files.  It also modifies the
  977. linker's search strategy for archive libraries, to support the use of
  978. libraries specific to each particular architecture, by including in the
  979. search loop names suffixed with the string identifying the architecture.
  980.  
  981.    For example, if your `ld' command line included `-ACA' as well as
  982. `-ltry', the linker would look (in its built-in search paths, and in
  983. any paths you specify with `-L') for a library with the names
  984.  
  985.      try
  986.      libtry.a
  987.      tryca
  988.      libtryca.a
  989.  
  990. The first two possibilities would be considered in any event; the last
  991. two are due to the use of `-ACA'.
  992.  
  993.    You can meaningfully use `-A' more than once on a command line, since
  994. the 960 architecture family allows combination of target architectures;
  995. each use will add another pair of name variants to search for when `-l'
  996. specifies a library.
  997.  
  998.    `ld' supports the `-relax' option for the i960 family.  If you
  999. specify `-relax', `ld' finds all `balx' and `calx' instructions whose
  1000. targets are within 24 bits, and turns them into 24-bit program-counter
  1001. relative `bal' and `cal' instructions, respectively.  `ld' also turns
  1002. `cal' instructions into `bal' instructions when it determines that the
  1003. target subroutine is a leaf routine (that is, the target subroutine does
  1004. not itself call any subroutines).
  1005.  
  1006. 
  1007. File: ld.info,  Node: BFD,  Next: MRI,  Prev: Machine Dependent,  Up: Top
  1008.  
  1009. BFD
  1010. ***
  1011.  
  1012.    The linker accesses object and archive files using the BFD libraries.
  1013. These libraries allow the linker to use the same routines to operate on
  1014. object files whatever the object file format.  A different object file
  1015. format can be supported simply by creating a new BFD back end and adding
  1016. it to the library.  To conserve runtime memory, however, the linker and
  1017. associated tools are usually configured to support only a subset of the
  1018. object file formats available.  You can use `objdump -i' (*note
  1019. objdump: (binutils.info)objdump.) to list all the formats available for
  1020. your configuration.
  1021.  
  1022.    As with most implementations, BFD is a compromise between several
  1023. conflicting requirements. The major factor influencing BFD design was
  1024. efficiency: any time used converting between formats is time which
  1025. would not have been spent had BFD not been involved. This is partly
  1026. offset by abstraction payback; since BFD simplifies applications and
  1027. back ends, more time and care may be spent optimizing algorithms for a
  1028. greater speed.
  1029.  
  1030.    One minor artifact of the BFD solution which you should bear in mind
  1031. is the potential for information loss.  There are two places where
  1032. useful information can be lost using the BFD mechanism: during
  1033. conversion and during output. *Note BFD information loss::.
  1034.  
  1035. * Menu:
  1036.  
  1037. * BFD outline::                 How it works: an outline of BFD
  1038.  
  1039. 
  1040. File: ld.info,  Node: BFD outline,  Up: BFD
  1041.  
  1042. How it works: an outline of BFD
  1043. ===============================
  1044.  
  1045.    When an object file is opened, BFD subroutines automatically
  1046. determine the format of the input object file.  They then build a
  1047. descriptor in memory with pointers to routines that will be used to
  1048. access elements of the object file's data structures.
  1049.  
  1050.    As different information from the the object files is required, BFD
  1051. reads from different sections of the file and processes them.  For
  1052. example, a very common operation for the linker is processing symbol
  1053. tables.  Each BFD back end provides a routine for converting between
  1054. the object file's representation of symbols and an internal canonical
  1055. format. When the linker asks for the symbol table of an object file, it
  1056. calls through a memory pointer to the routine from the relevant BFD
  1057. back end which reads and converts the table into a canonical form.  The
  1058. linker then operates upon the canonical form. When the link is finished
  1059. and the linker writes the output file's symbol table, another BFD back
  1060. end routine is called to take the newly created symbol table and
  1061. convert it into the chosen output format.
  1062.  
  1063. * Menu:
  1064.  
  1065. * BFD information loss::    Information Loss
  1066. * Canonical format::        The BFD    canonical object-file format
  1067.  
  1068. 
  1069. File: ld.info,  Node: BFD information loss,  Next: Canonical format,  Up: BFD outline
  1070.  
  1071. Information Loss
  1072. ----------------
  1073.  
  1074.    *Information can be lost during output.* The output formats
  1075. supported by BFD do not provide identical facilities, and information
  1076. which can be described in one form has nowhere to go in another format.
  1077. One example of this is alignment information in `b.out'. There is
  1078. nowhere in an `a.out' format file to store alignment information on the
  1079. contained data, so when a file is linked from `b.out' and an `a.out'
  1080. image is produced, alignment information will not propagate to the
  1081. output file. (The linker will still use the alignment information
  1082. internally, so the link is performed correctly).
  1083.  
  1084.    Another example is COFF section names. COFF files may contain an
  1085. unlimited number of sections, each one with a textual section name. If
  1086. the target of the link is a format which does not have many sections
  1087. (e.g., `a.out') or has sections without names (e.g., the Oasys format),
  1088. the link cannot be done simply. You can circumvent this problem by
  1089. describing the desired input-to-output section mapping with the linker
  1090. command language.
  1091.  
  1092.    *Information can be lost during canonicalization.* The BFD internal
  1093. canonical form of the external formats is not exhaustive; there are
  1094. structures in input formats for which there is no direct representation
  1095. internally.  This means that the BFD back ends cannot maintain all
  1096. possible data richness through the transformation between external to
  1097. internal and back to external formats.
  1098.  
  1099.    This limitation is only a problem when an application reads one
  1100. format and writes another.  Each BFD back end is responsible for
  1101. maintaining as much data as possible, and the internal BFD canonical
  1102. form has structures which are opaque to the BFD core, and exported only
  1103. to the back ends. When a file is read in one format, the canonical form
  1104. is generated for BFD and the application. At the same time, the back
  1105. end saves away any information which may otherwise be lost. If the data
  1106. is then written back in the same format, the back end routine will be
  1107. able to use the canonical form provided by the BFD core as well as the
  1108. information it prepared earlier.  Since there is a great deal of
  1109. commonality between back ends, there is no information lost when
  1110. linking or copying big endian COFF to little endian COFF, or `a.out' to
  1111. `b.out'.  When a mixture of formats is linked, the information is only
  1112. lost from the files whose format differs from the destination.
  1113.  
  1114. 
  1115. File: ld.info,  Node: Canonical format,  Prev: BFD information loss,  Up: BFD outline
  1116.  
  1117. The BFD canonical object-file format
  1118. ------------------------------------
  1119.  
  1120.    The greatest potential for loss of information occurs when there is
  1121. the least overlap between the information provided by the source
  1122. format, that stored by the canonical format, and that needed by the
  1123. destination format. A brief description of the canonical form may help
  1124. you understand which kinds of data you can count on preserving across
  1125. conversions.
  1126.  
  1127. *files*
  1128.      Information stored on a per-file basis includes target machine
  1129.      architecture, particular implementation format type, a demand
  1130.      pageable bit, and a write protected bit.  Information like Unix
  1131.      magic numbers is not stored here--only the magic numbers' meaning,
  1132.      so a `ZMAGIC' file would have both the demand pageable bit and the
  1133.      write protected text bit set.  The byte order of the target is
  1134.      stored on a per-file basis, so that big- and little-endian object
  1135.      files may be used with one another.
  1136.  
  1137. *sections*
  1138.      Each section in the input file contains the name of the section,
  1139.      the section's original address in the object file, size and
  1140.      alignment information, various flags, and pointers into other BFD
  1141.      data structures.
  1142.  
  1143. *symbols*
  1144.      Each symbol contains a pointer to the information for the object
  1145.      file which originally defined it, its name, its value, and various
  1146.      flag bits.  When a BFD back end reads in a symbol table, it
  1147.      relocates all symbols to make them relative to the base of the
  1148.      section where they were defined.  Doing this ensures that each
  1149.      symbol points to its containing section.  Each symbol also has a
  1150.      varying amount of hidden private data for the BFD back end.  Since
  1151.      the symbol points to the original file, the private data format
  1152.      for that symbol is accessible.  `ld' can operate on a collection
  1153.      of symbols of wildly different formats without problems.
  1154.  
  1155.      Normal global and simple local symbols are maintained on output,
  1156.      so an output file (no matter its format) will retain symbols
  1157.      pointing to functions and to global, static, and common variables.
  1158.      Some symbol information is not worth retaining; in `a.out', type
  1159.      information is stored in the symbol table as long symbol names.
  1160.      This information would be useless to most COFF debuggers; the
  1161.      linker has command line switches to allow users to throw it away.
  1162.  
  1163.      There is one word of type information within the symbol, so if the
  1164.      format supports symbol type information within symbols (for
  1165.      example, COFF, IEEE, Oasys) and the type is simple enough to fit
  1166.      within one word (nearly everything but aggregates), the
  1167.      information will be preserved.
  1168.  
  1169. *relocation level*
  1170.      Each canonical BFD relocation record contains a pointer to the
  1171.      symbol to relocate to, the offset of the data to relocate, the
  1172.      section the data is in, and a pointer to a relocation type
  1173.      descriptor. Relocation is performed by passing messages through
  1174.      the relocation type descriptor and the symbol pointer. Therefore,
  1175.      relocations can be performed on output data using a relocation
  1176.      method that is only available in one of the input formats. For
  1177.      instance, Oasys provides a byte relocation format.  A relocation
  1178.      record requesting this relocation type would point indirectly to a
  1179.      routine to perform this, so the relocation may be performed on a
  1180.      byte being written to a 68k COFF file, even though 68k COFF has no
  1181.      such relocation type.
  1182.  
  1183. *line numbers*
  1184.      Object formats can contain, for debugging purposes, some form of
  1185.      mapping between symbols, source line numbers, and addresses in the
  1186.      output file.  These addresses have to be relocated along with the
  1187.      symbol information.  Each symbol with an associated list of line
  1188.      number records points to the first record of the list.  The head
  1189.      of a line number list consists of a pointer to the symbol, which
  1190.      allows finding out the address of the function whose line number
  1191.      is being described. The rest of the list is made up of pairs:
  1192.      offsets into the section and line numbers. Any format which can
  1193.      simply derive this information can pass it successfully between
  1194.      formats (COFF, IEEE and Oasys).
  1195.  
  1196.